<style lang="less">
    @import '../../styles/common.less';
    @import '../tables/components/table.less';
</style>

<template>
    <div>
        <Row class="margin-top-10">
            <Col span="24">
                <Card>
                    <p slot="title" style="height: 32px;">
                        <span>选择测评车辆</span>
                        <Select v-model="model1" style="width:200px">
					        <Option v-for="item in teamList" :value="item.teamName" :key="item.teamName">{{ item.teamName }}</Option>
					    </Select>
                        <span class="margin-left-10">选择开始时间</span>
                        <DatePicker typr="datetime" placeholder="Select date and time" style="width: 200px;"></DatePicker>
                        <span class="margin-left-10">选择结束时间</span>
                        <DatePicker typr="datetime" placeholder="Select date and time" style="width: 200px;"></DatePicker>
                        <Button @click="search" type="primary" icon="search" class="margin-left-10">查询</Button>
                       
                    </p>
                    <Row :gutter="10">
                        <Col span="24">
                            <div>
                                <can-edit-table 
                                    refs="table4" 
                                    v-model="editInlineAndCellData" 
                                    :columns-list="editInlineAndCellColumn"
                                ></can-edit-table>
                                
                            </div>
                            
                        </Col>
					    
                    </Row>
                    <div style="margin-top: 10px;overflow: hidden">
				        <div style="float: left;">
				            <Page :total="total" @on-change="PageNo" :page-size="pageSize" show-elevator ></Page>
				        </div>
				    </div>
                </Card>
            </Col>
        </Row>
    </div>  
</template>

<script>
import 'jquery';
import tableData from './achieve_table_data.js';
import canEditTable from '../components/canEditTable.vue';
import {adminId,accessToken} from '../components/date.js';
import {baseurl} from '../../libs/util.js';

export default {
    name: 'achieve_index',
    components: {
        canEditTable
    },
    data () {
        return {
        	teamList:[],
            editInlineAndCellColumn: [],
            editInlineAndCellData: [],
            modal1: false,
	        total: 1,
	        pageSize: 10,	       
        };
    },
    mounted:function(){
		this.team();
		this.getTeamList();
	},
    methods: {
    	team : function(pageNo){
    		var _self = this;
                $.ajax({
                    type: "get",
                    url: baseurl + 'scenesResults',
                    async: false,
                    data:{
						"currentPage":1,
						"pageSize":999,
					},  
                    async: false,
                    dataType: 'json',
                    contentType: "application/json; charset=utf-8",
                    beforeSend: function (request) {
                        request.setRequestHeader("accessToken", accessToken);
                    },
                    success: function (data) {
                    	if(data.code == 1){
							var result = data.result;
							_self.editInlineAndCellData  = result;
                    	}
                    }
        		});
		},
		getTeamList(){
			var _self = this;
                $.ajax({
                    type: "get",
                    url: baseurl + 'users/' + adminId + "/teams",
                    async: false,
                    data:{
						"currentPage":1,
						"pageSize":999,
					},  
                    async: false,
                    dataType: 'json',
                    contentType: "application/json; charset=utf-8",
                    beforeSend: function (request) {
                        request.setRequestHeader("accessToken", accessToken);
                    },
                    success: function (data) {
                    	if(data.code == 1){
							var result = data.result;
							_self.teamList = result;
                    	}
                    }
        		});
			
		},
        getData () {
           // this.editInlineAndCellData = tableData.editInlineData;
            this.editInlineAndCellColumn = tableData.editInlineAndCellColumn;
        },
        //分页对应的页数
        PageNo (e) {
            console.log(e);
            //this.team(e);
        },
    },
     created () {
        this.getData();
    }
};
</script>
